<%@page import="com.skeleton.utils.SystemConstants"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>登录</title>
	<link href="<%=request.getContextPath() %>/resource/css/ske-login.css" rel="stylesheet" type="text/css" />
	<script src="<%=request.getContextPath() %>/resource/js/jquery-1.8.2.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/ske-common.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/ske-login.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=request.getContextPath() %>/resource/js/ske-encrypt.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		function login() {
			var name = $('#loginname').val();
			var pass = $('#password').val();
			if(!isEmpty(name) && !isEmpty(pass)) {
				$.ajax({
					url: "<%=request.getContextPath() %>/user/ajaxLogin",
					data: {
						loginname: name,
						password: encrypt(name, pass)
					},
					dataType: "JSON",
					type: "POST",
					success: function(res) {
						if(res.result == "<%=SystemConstants.AJAX_SUCCESS %>") {
							location.href = "<%=request.getContextPath() %>/blog/index";
						} else {
							alert(res.msg);
						}
					}
				});
			}
		}
	</script>
</head>
<body>
	<div class="common-width-all">
		<div class="common-low-width-center login-top">
			<div class="common-low-width-center head">
				<div class="fright">
					<a href="" id="logo" class="head fleft"></a>
					<a href="<%=request.getContextPath() %>/regist" id="regist" class="head fleft">
						<span>注册</span>
					</a>
				</div>
				<div class="cboth"></div>
			</div>
			<div class="common-low-width-center logo">
			</div>
			<div class="common-low-width-center loginForm">
				<input type="text" class="ipt uid fleft" id="loginname" autocomplete="off">
				<input type="password" class="ipt psw fleft" id="password">
				<a href="javascript: login();" title="登录" class="loginBtn fleft" id="loginBtn">
					<span>登录</span>
				</a>
				<a href="" title="找回密码" class="countable fleft">找回密码</a>
				<span class="errtips" id="tips" style="display:none"></span>
			</div>
		</div>
	</div>
</body>
</html>